
import request from '@/utils/request'

// 获取部门的列表
export function getDepartments() {
  return request({
    url: '/company/department'
  })
}

// 获取部门负责人
export function getUserSimple() {
  return request({
    url: '/sys/user/simple'
  })
}

// 新增子部门
/**
 *
 * @param {name,code,id,pid,introduce} data
 * @returns
 */
export function addDepartment(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 *获取部门详情的数据
 * @param id
 * @returns
 */
export function getDepartmentDetail(id) {
  return request({
    url: '/company/department/' + id,
    method: 'get'

  })
}
/**
 *  编辑部门
 * @param id
 * @returns
 */
export function updateDepartment(data) {
  return request({
    url: '/company/department/' + data.id,
    method: 'put',
    data
  })
}

/**
 * 删除部门
 *
*/

export function delDepartment(id) {
  return request({
    method: 'delete',
    url: `/company/department/${id}`
  })
}

